<%@ include file="/en/jsp/static.jsp" %>
<%@ taglib uri="/linuxbox/common.tld" prefix="common" %>

<%
  String NAME = (String) request.getAttribute("NAME");
  String LOCATION = (String) request.getAttribute("LOCATION");
  String DESCRIPTION = (String) request.getAttribute("DESCRIPTION");
  int ALLOWPEOPLE = Integer.parseInt((String)request.getAttribute("ALLOWPEOPLE"));
  int CATEGORY = Integer.parseInt((String)request.getAttribute("CATEGORY"));
  int ID = Integer.parseInt((String)request.getAttribute("ID"));
%>

<jsp:include page="/en/jsp/header.jsp" flush="true"/>

<form action="<%=BoxStatic.servletDir%>BoxResourceAction" method=post name="theForm">

<table width="100%" height=26 align=middle border=0 cellpadding=0 cellspacing=0 bgcolor="#f4f4f4" style="font-size:16px;color:#d05000">
  <tr>
    <td>
      &nbsp;<img src="<%=BoxStatic.imageDir%>itemball.jpg" width=14 height=15 border=0 align="absmiddle">
      <b><%=boxName%> - Resource Add/Edit</b>
    </td>
    <td align=right>
      <a href="<%=BoxStatic.jspDir%>resource/BoxResource.jsp">
        Resource List
      </a>
    </td>
  </tr>
</table>

<hr width="100%" color=#E06000 align=left>

  <table width= "100%" border=1 cellspacing=0 cellpadding=1>
    <tr><td>
      <table border=0 width="100%" bgcolor=#e0e0e0 style="font-size:14px">
        <input type=hidden name=ID value=<%=ID%>>
        <tr><td>
          <input type=submit value=
<%
      if (ID==0)
        out.println("\"Add\" name=SubmitSave");
      else
      {
        out.println("\"Update\" name=SubmitUpdate>");
        out.println("<input type=submit value=\"Delete\" name=SubmitDelete");
      }
%>
            >
          <input type=button value="Cancel" onclick="window.history.go(-1)" >
        </td></tr>

        <tr><td>
          <b>Name:</b> <input align=right type=text name=NAME size=30 value="<%=NAME%>">
          <b>Category:</b>
          <select name="CATEGORY" size="1">
<%
  if (CATEGORY == 0)
    out.print("<option value=0 selected></option>");
  else
    out.print("<option value=></option>");
%>
            <jsp:useBean id="home" class="linuxbox.resource.logic.BoxResourceCat"/>
            <common:Iteration name="cat" type="linuxbox.resource.logic.BoxResourceCatEntry" group="<%=home.getAllCategories()%>">
<%
                if ( CATEGORY == cat.getID() )
                  out.print("<option value=\""+cat.getID()+"\" selected>"+cat.getName()+"</option>");
                else
                  out.print("<option value=\""+cat.getID()+"\">"+cat.getName()+"</option>");
%>
            </common:Iteration>
          </select>

        </td></tr>
        <tr><td>
          <b>Description:</b><br>
          <textarea name=DESCRIPTION rows=5 cols=60><%=DESCRIPTION%></textarea><br>
        </td></tr>
        <tr><td>
          <b>Location:</b> <input align=right type=text name=LOCATION size=30 value="<%=LOCATION%>">
          <b>Allow People:</b> <input align=right type=text name=ALLOWPEOPLE size=3 value="<%=ALLOWPEOPLE%>">
        </td></tr>
        <tr><td>
          <input type=submit value=
<%
      if (ID==0)
        out.println("\"Add\" name=SubmitSave");
      else
      {
        out.println("\"Update\" name=SubmitUpdate>");
        out.println("<input type=submit value=\"Delete\" name=SubmitDelete");
      }
%>
            >
          <input type=button value="Cancel" onclick="window.history.go(-1)" >
        </td></tr>
      </table>
    </td></tr>
  </table>


<hr width="100%" color=#E06000 align=left>

</form>

<jsp:include page="/en/jsp/footer.jsp" flush="true"/>
